using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class t_SysFunctionMap : EntityTypeConfiguration<t_SysFunction>
    {
        public t_SysFunctionMap()
        {
            // Primary Key
            this.HasKey(t => t.FFuncID);

            // Properties
            this.Property(t => t.FFuncID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FNumber)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FDescription)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.FDescription_en)
                .HasMaxLength(80);

            this.Property(t => t.FDescription_cht)
                .HasMaxLength(80);

            // Table & Column Mappings
            this.ToTable("t_SysFunction");
            this.Property(t => t.FFuncID).HasColumnName("FFuncID");
            this.Property(t => t.FNumber).HasColumnName("FNumber");
            this.Property(t => t.FSubSysID).HasColumnName("FSubSysID");
            this.Property(t => t.FDescription).HasColumnName("FDescription");
            this.Property(t => t.FDescription_en).HasColumnName("FDescription_en");
            this.Property(t => t.FDescription_cht).HasColumnName("FDescription_cht");

            // Relationships
            this.HasRequired(t => t.t_SubSystem)
                .WithMany(t => t.t_SysFunction)
                .HasForeignKey(d => d.FSubSysID);

        }
    }
}
